import minRequest from '@/config/minRequest.js'
const url = '/customer'
/**
 * 顾问列表
 * @param {Object} { pageNum: number, pageSize: number }
 */
// export const consultant = (data) => minRequest.get(url + '/CustomerMeeting/consultant', data)
export const consultant = (data) => minRequest.post(url + '/CustomerManageFor/querySalesman', data)

// 历史会议
export const getHistoryMeet = (data) => minRequest.post(url + '/CustomerMeetingSignIn/getHistoryMeetByCustomerId', data)

/**
 * 根据报名id查询会议相关信息 
 * @param {number | string} signUpId  
 */

export const getMeetingWithSalesMan = async (signUpId) => {
	// return minRequest.get(`/CustomerMeeting/getMeetWithSalesMan/${signUpId}`)
	return minRequest.get(url + `/CustomerMeeting/getMeetWithSalesMan/${signUpId}`).then((result) => {
		return result
	}).catch(err => {
		return err
	})
}

/**
 * 根据会议id查询会议相关信息 
 * @param {number | string}  
 */

export const getMeetingWithMeetId = async (meetId) => {
	return minRequest.get(url + `/CustomerMeeting/open/getMeetById/${meetId}`).then((result) => {
		return result
	}).catch(err => {
		return err
	})
}

/**
 * 根据报名id查询会议相关信息 
 * @param {number | string} signUpId  
 */

export const getMeetingWithSalesMan2 = async (signUpId) => {
	// return minRequest.get(`/CustomerMeeting/getMeetWithSalesMan/${signUpId}`)
	return minRequest.get(url + `/CustomerMeeting/getMeetWithSalesMan/${signUpId}`).then((result) => {
		return result.data
	}).catch(err => {
		return err.msg
	})
}

/**
 * 根据报名id查询报名会议相关信息 
 * @param {number | string} signUpId  
 */

export const getCustomerSignUp = async (customerSignUpId) => {
	return minRequest.get(url + `/customerSignUp/getCustomerSignUpById/${customerSignUpId}`).then((result) => {
		return result.data
	}).catch(err => {
		return err.msg
	})
}

/**
 * 签到 
 * @param {Object}
 */
export const CustomerMeetingSignIn = async (params) => {
	return minRequest.post(url + '/CustomerMeetingSignIn/signIn', params).then(result => {
		return result
	}).catch(error => {
		return error
	})
}

/**
 * 我的顾问
 * @param {Object} 
 */
export const getSalesManMeet = (params) => {
	return minRequest.get(url + `/CustomerMeeting/getSalesManMeet/${params.salesManId}`, params.data)
}

/**
 * 报名
 * @param {Object}
 */
export const customerSignUp = async (params) => {
	return minRequest.post(url + '/customerSignUp/addCustomerSignUp', params).then(result => {
		return result
	}).catch(error => {
		return error
	})
}

/**
 * 1219根据会议ID查询该会议的客户签到列表
 * @param {Object} 
 */
export const listCustomerSignInByMeetId = (meetId) => {
	return minRequest.get(url + `/CustomerMeetingSignIn/listCustomerSignInByMeetId/${meetId}`)
}

/**
 * 根据会议ID查询最近N次抽奖记录
 * @param {Object} 
 */
export const recentlyDrawALottery = (meetId,limit) => {
	return minRequest.get(url + `/prize_draw/cus/recentlyDrawALottery/${meetId}/${limit}`)
}
